function C.InPlanet( ent )
	
	if( table.HasValue( C.NoGravApplied, ent:GetClass() ) or ent.Cosmic ) then
		
		return ent.CurrentPlanet or 0;
		
	end
	
	for k, v in pairs( C.MapObjects.Planets ) do
		
		if( v.pos:Distance( ent:GetPos() ) < v.radius ) then 
			
			return k;
			
		end
		
	end
	
	return 0;
	
end

function C.CheckPlanetDistance( ent )
	
	if( !ent.NextPlanetCheck ) then ent.NextPlanetCheck = 0 end
	if( !ent.CurrentPlanet ) then ent.CurrentPlanet = 0 end
	
	if( CurTime() < ent.NextPlanetCheck ) then return end
	
	ent.NextPlanetCheck = CurTime() + 1;
	
	for k, v in pairs( C.MapObjects.Planets ) do
		
		if( v.pos:Distance( ent:GetPos() ) < v.radius ) then 
			
			ent.CurrentPlanet = k;
			return;
			
		end
		
	end
	
	ent.CurrentPlanet = 0;
	
end

function GM:PlayerNoClip( ply )
	
	if( ply:IsAdmin() ) then return true end
	
	if( C.InPlanet( ply ) > 0 ) then return true end
	
	return false;
	
end